package com.caiyouxi.notification.controller;

import com.caiyouxi.common.bean.ResData;
import com.caiyouxi.notification.model.NotificationBean;
import com.caiyouxi.notification.service.NotificationService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Administrator on 2017/12/21.
 */
@RestController
@RequestMapping("/notificaton")
public class NotificationController {

    private Logger logger = Logger.getLogger(NotificationController.class);

    @Autowired
    private NotificationService notificationService;

    /**
     *查询所有通知，放回通知列表
     * */
    @RequestMapping("/get_notification_list")
    public ResData get_notification_list(HttpServletRequest request, HttpServletResponse response, @RequestBody NotificationBean notificationBean){
        logger.info("查询所有通知");
        return notificationService.get_notification_list(notificationBean);
    }
    /**
     *新增通知
     * */
    @RequestMapping("/add_notification")
    public ResData add_notification(HttpServletRequest request, HttpServletResponse response,@RequestBody NotificationBean notificationBean){
        logger.info("新增通知");
        return notificationService.add_notification(notificationBean);
    }

    /**
     *删除通知
     * */
    @RequestMapping("/del_notification")
    public ResData del_notification(HttpServletRequest request, HttpServletResponse response,@RequestBody NotificationBean notificationBean){
        logger.info("删除通知");
        return notificationService.del_notification(notificationBean);
    }

}
